/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package frontera;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.ImageIcon;

/**
 *
 * @author Stiv
 */
public class Imagen extends javax.swing.JPanel {
    
    private String img;
    private Image imagen;
    private String rutaImagen;
    public File A;

    /**
     * Creates new form Imagen
     */
    public Imagen() {
        initComponents();
    }
    
    public void showimg(File camino) {
		imagen = (Toolkit.getDefaultToolkit()).getImage(camino.getPath()); 
                A = camino;
		this.repaint();
                
	}
    


    @Override
	public void paintComponent(Graphics e) {
                Graphics2D g2 =(Graphics2D) e;
                super.paintComponents(e);
                ImageIcon i = new ImageIcon(A.getPath());
                i.paintIcon(this, e, 20, 0);
                
                
		//int h = this.getHeight();
		//int w = this.getWidth();
                   // g2.drawImage(imagen, 0, 0, w, h, null);
                    
                

	}
        public Image getImage(){
            return this.imagen;
        }

        public String getRuta(){
        return this.rutaImagen;
        }

        public void setRutaImagen(String r){
        this.rutaImagen=r;
        }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 252, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 386, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
